<div class="tabbable">
  <ul class="nav nav-tabs">
      <li class="active"><a href="#1" data-toggle="tab"><i class="icon16 cc-icon-users-2"></i>{$title}</a></li>
  </ul>
  <div class="tab-content">
    <div class="tab-pane active" id="1">
        <form id ="fm_level"class="well form-inline" action="#" method="get">
       
       <div class="control-group" >
      <label class="control-label" for="input01">选择用户：</label>
      <div class="controls" style="width:350px">
        <tagLib name="html" /> 
         <html:select id="UserLevel" name="UserLevel" options="levels" />  
      </div>
      </div>

        <button type="button" id="btn_save" class="btn btn-small"><i class="cc-icon-floppy "></i> 保存更改</button>
        </form>
        
        <form id ="fm_authority" action="__APP__/System/authority_update" method="Post">
            <input type="hidden" id="Type" name="Type" value="2" />
            <input type="hidden" id="curr_level" name="curr_level" value="{$current_level}" />
            <input type="hidden" id="views" name="views" value="" />
            <input type="hidden" id="adds" name="adds" value="" />
            <input type="hidden" id="updates" name="updates" value="" />
            <input type="hidden" id="deletes" name="deletes" value="" />
            
            <table id="client_data" cellpadding="0" cellspacing="0" border="0" class="dynamicTable display table table-bordered">
            <thead>
                <tr>

              
                    <th style="width:15%;">功能名称</th>
                    <th style="width:25%;">功能说明</th>
                    <th style="width:100px;">分类</th>
                    <th style="width:80px;"><label for="checkall_view"><input id="checkall_view" type="checkbox" />访问</label></th>
                    <th style="width:80px;"><label for="checkall_add"><input id="checkall_add" type="checkbox" />新增</label></th>
                    <th style="width:80px;"><label for="checkall_update"><input id="checkall_update" type="checkbox" />修改</label></th>
                    <th style="width:80px;"><label for="checkall_delete"><input id="checkall_delete" type="checkbox" />删除</label></th>
                    <th style="width:80px;">特殊权限</th>
                </tr>
            </thead>
            <tbody>
                 <iterate name="data" id="item" key="k">
                     <if condition="($item['p_name'] eq '')">
                        <tr style="background-color:#E8EAEB">
                     <else/>
                        <tr>
                     </if>
                    <td><input type="hidden" id="menuid[]" name="menuid[]" value="{$item['MenuId']}" />
                        {$item['MenuName']}</td>
                    <td style="text-align: left;"><php>echo nl2br($item['MenuDesc']);</php></td>
                 <td>{$item['p_name']}</td>
                 <td>
                      <input class="View nostyle"  type="checkbox" <php> if($item['View']==1) echo 'checked="checked"'</php>>
                      
                    <td>
                        <input type="checkbox" <php> if($item['Add']==1) echo 'checked="checked"'</php> class="Add nostyle">
                    </td>
                    <td>
                        <input type="checkbox"  <php> if($item['Update']==1) echo 'checked="checked"'</php> class="Update nostyle">
                        
                    </td>
                    <td>
                        <input type="checkbox"  <php> if($item['Delete']==1) echo 'checked="checked"'</php> class="Delete nostyle">
                    </td>
                    <td>
                        <input name="Special[]" id="Special" value="{$item['Special']}" style="width:80px" class="input1"/>
                    </td>

                 </tr>

                </iterate>
            </tbody>
        </table>
        </form>
    </div>
 
  </div>
</div>
<script type="text/javascript">
     $(function(){
         $("input, textarea, select").not(".nostyle").uniform();
         
         $("#UserLevel").val($("#curr_level").val()).change();
         $("#User").val($("#curr_user").val()).change();
         
         
         $("#UserLevel").change(function(){
             $("#fm_level").submit();
         });
         $("#User").change(function(){
             $("#fm_user").submit();
         });
         
         $("#btn_save").click(function(){
             var arr_view = new Array();
             var arr_add = new Array();
             var arr_update = new Array();
             var arr_delete = new Array();
             
             $('.View').each(function(n,e){
                 if($(e).attr("checked")!= undefined)
                    arr_view.push(1);
                else
                    arr_view.push(0);
             });
             
             $('.Add').each(function(n,e){
                 if($(e).attr("checked")!= undefined)
                    arr_add.push(1);
                else
                    arr_add.push(0);
             });
             
             $('.Update').each(function(n,e){
                 if($(e).attr("checked")!= undefined)
                    arr_update.push(1);
                else
                    arr_update.push(0);
             });
             
             $('.Delete').each(function(n,e){
                 if($(e).attr("checked")!= undefined)
                    arr_delete.push(1);
                else
                    arr_delete.push(0);
             });
             
              $('#views').val(arr_view);
              $('#adds').val(arr_add);
              $('#updates').val(arr_update);
              $('#deletes').val(arr_delete);

              $("#fm_authority").submit();
         });
         
         
         $("#checkall_view").click(function(){
            $('.View').attr("checked",this.checked); 
         });
         
         $("#checkall_add").click(function(){
            $('.Add').attr("checked",this.checked); 
         });
         
         $("#checkall_update").click(function(){
            $('.Update').attr("checked",this.checked); 
         });
         
         $("#checkall_delete").click(function(){
            $('.Delete').attr("checked",this.checked); 
         });
     });
 </script>